<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="utf-8" />
<title>BUG查询系统</title>
<link rel="stylesheet" href="css/result.css" />
<link rel="stylesheet" href="css/index.css" />
<script type="text/javascript" charset="UTF-8" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="js/main.js"></script>
<style type="text/css">
.cheangBugsInfo_div {
	width: 403px;
	border: 1px solid #dedede;
	display: none;
}
.ajax_bug_info_1{
	margin-top: 5px;
	cursor: pointer;
}
.a123_back{
	background-color: #dedede;
}
.cheangBugsInfo_div{
	z-index: 1000;
	position: relative;
}
</style>
</head>

<body>
	<!-- 引入头部 -->
	<div>
		<jsp:include page="top.jsp"></jsp:include>
	</div>
	<div style="height: 200px;"></div>

	<!--
        	作者：offline
        	时间：2017-03-13
        	描述：正文
       -->
	<div>
		<div class="main_div">
			<!--
                   	作者：offline
                   	时间：2017-03-13
                   	描述：Logo
                   -->
			<div>
				<div class="logo_div">
					<img src="images/logo/logo.png" />
				</div>
				<!--
                    	作者：offline
                    	时间：2017-03-13
                    	描述：搜索框
                    -->
				<div class="search_div">
					<div class="select_div float_left">
						<input type="text" class="searche_input" /><input type="submit" class="select_btn" value="查  询" />
					</div>
					
					<div class="search_btn float_left">
						<%-- 提示信息数据 --%>
						<div class="cheangBugsInfo_div"></div>
					</div>
					

					<div class="clear_float"></div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		/* 检索框的修改事件 */
		$(function() {
			$(".searche_input").on("keyup",function(even) {
						var str = $(this).val().trim();
						console.log(str + "----" + even.keyCode + "---" + str.length);
						if (str.length != 0) {
							console.log("请求数据...." + str);
							$.ajax({
								url : "bugInfo/ajaxBug/" + str,
								success : function(msg) {
									console.log(msg);
									/*	
										1. 清空原有的数据
										2. 解析MSG
										3. 绑定到div
									 */
									$(".cheangBugsInfo_div").empty();
									var obj = eval('(' + msg + ')');

									for ( var i = 0; i < obj.length; i++) {
										var o = obj[i];
										$(".cheangBugsInfo_div").append("<div style='margin-top: 5px'><a class='ajax_bug_info_1' href='bugInfo/description?description="+o['description']+"' style='font-size:17px;' value="+o['bugId']+">"+ o['description']+ "</a></div>");
									}
									$(".cheangBugsInfo_div").css("display","block");

								}
							});
						}else{
							$(".cheangBugsInfo_div").hide();
						}
					});
		});
		
		$(function(){
			$(".ajax_bug_info_1").on("click",function(){
				console.log("*************8888");
				//$(this).addClass("a123_back").siblings().removeClass("a123_back");
			});
		});
	</script>
	<!--
        	作者：offline
        	时间：2017-03-13
        	描述：引入底部
        -->
	<jsp:include page="foot.jsp"></jsp:include>
</body>

</html>